﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace sy3_2
{
    class Program
    {
        static void Main(string[] args)
        {
                float length, width, price;
                int layers;

                Console.Write("请输入楼房长(米)：");
                length = float.Parse(Console.ReadLine()); 

                Console.Write("请输入楼房宽(米)：");
                width = float.Parse(Console.ReadLine());

                Console.Write("请输入楼房层数(层)：");
                layers = int.Parse(Console.ReadLine()); 

                Console.Write("请输入楼单价(万元)：");
                price = float.Parse(Console.ReadLine());

                Building b = new Building(length, width, layers);
                b.MyPrice = price;

                Console.WriteLine("\n========以下是输出========");
                Console.WriteLine("楼房总面积(平方)：" + b.GetArea());
                Console.WriteLine("楼房总价格(万元)：" + b.TotalPrice());
                Console.WriteLine("按任意键结束程序：");
                Console.ReadKey(); 
            }
        }
    }

    class Building
    {
        private float length; 
        private float width;  
        private int layers;    
        private float price;  

        public float GetArea()
        {
            return length * width * layers;
        }

        public float TotalPrice()
        {
            return GetArea() * price;
        }

        public float MyPrice
        {
            set { price = value; } 
            get { return price; }   
        }

        public Building(float l, float w, int lys)
        {
            length = l;
            width = w;
            layers = lys;
        }
    }
